package com.cskaoyan.controller.wx.topic;

import com.cskaoyan.bean.MarketGoods;
import com.cskaoyan.bean.MarketTopic;
import com.cskaoyan.bean.common.BasePageInfo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.bean.vo.wx.top.TopicDetailVo;
import com.cskaoyan.service.wx.topic.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author: erdonc
 * @date: 2022/9/11 17:18
 * TODO: 专题模块
 */
@RestController
@RequestMapping("/wx/topic")
public class WxTopicController {

    @Autowired
    WxTopicService topicService;


    /**
     * @Author: erdonc
     * @date : 2022/9/11 17:35
     * TODO: 显示专题页面
     * Request URL: http://182.92.235.201:8083/wx/topic/list?page=1&limit=10
     */
    @RequestMapping("list")
    public BaseRespVo list(BasePageInfo pageInfo) {
        CommonData<MarketTopic> commonData = topicService.list(pageInfo);
        return BaseRespVo.ok(commonData);
    }


    /**
     * @Author: erdonc
     * @date : 2022/9/11 20:09
     * TODO: 根据页面请求id，查询专题信息和专题相关商品信息
     * Request URL: http://182.92.235.201:8083/wx/topic/detail?id=368
     */
    @RequestMapping("detail")
    public BaseRespVo detail(Integer id) {
        TopicDetailVo topicDetailVo = topicService.detail(id);
        return BaseRespVo.ok(topicDetailVo);
    }


    /**
     * @Author: erdonc
     * @date : 2022/9/11 20:27
     * TODO:获取专题相关推荐
     * Request URL: http://182.92.235.201:8083/wx/topic/related?id=368
     */
    @RequestMapping("related")
    public BaseRespVo related(Integer id) {

        CommonData<MarketTopic> commonData = topicService.related(id);
        return BaseRespVo.ok(commonData);
    }
}
